/**
 * 
 */
package com.estock.web.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.estock.common.exception.ESRuntimeException;

/**
 * @author richard
 * 		
 */
@Controller
public class HomeController {
	
	protected final Logger logger = Logger.getLogger(HomeController.class);
	
	@RequestMapping({ "/smart.es" })
	public ModelAndView index(HttpServletRequest request,
            HttpServletResponse response, ModelMap modelMap) throws Exception {
		logger.info("start accessing smart index");
		return new ModelAndView("smart", modelMap);  
    }
	
	// test error page
	@RequestMapping({ "/error.es" })
	public ModelAndView error(HttpServletRequest request,
            HttpServletResponse response, ModelMap modelMap) throws Exception {
		throw new ESRuntimeException("A internal Error happened");
    }

}
